import request from "@/network/request";


export function register(telephone, name, password, otpCode) {
    return request({
        url: '/system/user/register',
        params: {
            telephone,
            name,
            password,
            otpCode
        }
    });
}

export function login(telephone, password) {
    return request({
        url: '/system/user/login',
        params: {
            telephone: telephone,
            password: password,
        }
    });
}

export function getInfo() {
    return request({
        url: '/system/user/get',
    });
}

export function logout() {
    return request({
        url: '/system/user/logout',
    });
}

export function setUserEmail(email) {
    return request({
        url: '/system/user/setEmail',
        params: {
            email
        }
    })
}

export function getUserProfile(userId) {
    return request({
        url: '/system/user/profile',
        params: {
            userId
        }
    });
}

export function updateBaseInfo(userModel) {
    return request({
        url: "/system/user/updateBaseInfo",
        data: userModel
    })
}

export function getUserList() {
    return request({
        url: "/system/user/userList"
    })
}

export function getAllRole(){
    return request({
        url:'/system/role/allRole',
    })
}

export function roleUser(userId) {
    return request({
        url: '/system/roleUser/list',
        params: {
            userId
        }
    })
}


export function saveRoleUser(userId, roleList) {
    return request({
        url: '/system/roleUser/saveRoleUser',
        params: {
            userId
        },
        data: roleList
    })
}